}
}
-static void
-get_coordinates (GdkDevice *device,
- double *x,
- double *y,
- double *x_root,
- double *y_root)
-{
- GdkWaylandPointerData *pointer = GDK_WAYLAND_DEVICE (device)->pointer;
- int root_x, root_y;
-
- if (x)
- *x = pointer->surface_x;
- if (y)
- *y = pointer->surface_y;
-
- if (pointer->focus)
- {
- gdk_surface_get_root_coords (pointer->focus,
- pointer->surface_x,
- pointer->surface_y,
- &root_x, &root_y);
- }
- else
- {
- root_x = pointer->surface_x;
- root_y = pointer->surface_y;
- }
-
- if (x_root)
- *x_root = root_x;
- if (y_root)
- *y_root = root_y;
-}
-
static GdkModifierType
device_get_modifiers (GdkDevice *device)
{
static void
gdk_wayland_device_query_state (GdkDevice *device,
- GdkSurface *surface,
- GdkSurface **child_surface,
+ GdkSurface *surface,
+ GdkSurface **child_surface,
gdouble *root_x,
gdouble *root_y,
gdouble *win_x,
{
GdkWaylandPointerData *pointer;
GList *children = NULL;
+ int x_root, y_root;
if (surface == NULL)
children = gdk_wayland_display_get_toplevel_surfaces (gdk_device_get_display (device));
if (mask)
*mask = device_get_modifiers (device);
- get_coordinates (device, win_x, win_y, root_x, root_y);
+ if (win_x)
+ *win_x = pointer->surface_x;
+ if (win_y)
+ *win_y = pointer->surface_y;
+
+ if (pointer->focus)
+ {
+ gdk_surface_get_root_coords (pointer->focus,
+ pointer->surface_x,
+ pointer->surface_y,
+ &x_root, &y_root);
+ }
+ else
+ {
+ x_root = pointer->surface_x;
+ y_root = pointer->surface_y;
+ }
+
+ if (root_x)
+ *root_x = x_root;
+ if (root_y)
+ *root_y = y_root;
}
static void
GdkWaylandSeat *seat = data;
GdkEvent *event;
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (seat->display);
- double x, y, x_root, y_root;
if (!surface)
return;
seat->pointer_info.surface_y = wl_fixed_to_double (sy);
seat->pointer_info.enter_serial = serial;
- get_coordinates (seat->master_pointer, &x, &y, &x_root, &y_root);
event = gdk_event_crossing_new (GDK_ENTER_NOTIFY,
seat->pointer_info.focus,
seat->master_pointer,
seat->pointer,
0,
0,
- x, y,
+ seat->pointer_info.surface_x,
+ seat->pointer_info.surface_y,
GDK_CROSSING_NORMAL,
GDK_NOTIFY_NONLINEAR);
gdk_wayland_seat_set_frame_event (seat, event);
GdkWaylandSeat *seat = data;
GdkEvent *event;
GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY (seat->display);
- double x, y, x_root, y_root;
if (!surface)
return;
_gdk_wayland_display_update_serial (display_wayland, serial);
- get_coordinates (seat->master_pointer, &x, &y, &x_root, &y_root);
event = gdk_event_crossing_new (GDK_LEAVE_NOTIFY,
seat->pointer_info.focus,
seat->master_pointer,
seat->pointer,
0,
0,
- x, y,
+ seat->pointer_info.surface_x,
+ seat->pointer_info.surface_y,
GDK_CROSSING_NORMAL,
GDK_NOTIFY_NONLINEAR);
gdk_wayland_seat_set_frame_event (seat, event);
GdkWaylandSeat *seat = data;
GdkWaylandDisplay *display = GDK_WAYLAND_DISPLAY (seat->display);
GdkEvent *event;
- double x, y, x_root, y_root;
if (!seat->pointer_info.focus)
return;
seat->pointer_info.surface_x = wl_fixed_to_double (sx);
seat->pointer_info.surface_y = wl_fixed_to_double (sy);
- get_coordinates (seat->master_pointer, &x, &y, &x_root, &y_root);
-
event = gdk_event_motion_new (seat->pointer_info.focus,
seat->master_pointer,
seat->pointer,
NULL,
time,
device_get_modifiers (seat->master_pointer),
- x, y,
+ seat->pointer_info.surface_x,
+ seat->pointer_info.surface_y,
NULL);
gdk_wayland_seat_set_frame_event (seat, event);
GDK_SEAT_NOTE (seat, EVENTS,
g_message ("motion %f %f, seat %p state %d",
- wl_fixed_to_double (sx), wl_fixed_to_double (sy),
+ event->motion.x, event->motion.y,
seat, event->motion.state));
if (display->seat_version < WL_POINTER_HAS_FRAME)
GdkEvent *event;
uint32_t modifier;
int gdk_button;
- double x, y, x_root, y_root;
if (!seat->pointer_info.focus)
return;
if (state)
seat->pointer_info.press_serial = serial;
- get_coordinates (seat->master_pointer, &x, &y, &x_root, &y_root);
-
event = gdk_event_button_new (state ? GDK_BUTTON_PRESS : GDK_BUTTON_RELEASE,
seat->pointer_info.focus,
seat->master_pointer,
time,
device_get_modifiers (seat->master_pointer),
gdk_button,
- x, y,
+ seat->pointer_info.surface_x,
+ seat->pointer_info.surface_y,
NULL);
gdk_wayland_seat_set_frame_event (seat, event);
gdouble dy)
{
GdkEvent *event;
- double x, y, x_root, y_root;
if (!seat->pointer_info.focus)
return;
seat->pointer_info.time = _time;
- get_coordinates (seat->master_pointer, &x, &y, &x_root, &y_root);
event = gdk_event_touchpad_swipe_new (seat->pointer_info.focus,
seat->master_pointer,
seat->pointer,
_time,
device_get_modifiers (seat->master_pointer),
phase,
- x, y,
+ seat->pointer_info.surface_x,
+ seat->pointer_info.surface_y,
n_fingers,
dx, dy);
gdouble angle_delta)
{
GdkEvent *event;
- double x, y, x_root, y_root;
if (!seat->pointer_info.focus)
return;
seat->pointer_info.time = _time;
- get_coordinates (seat->master_pointer, &x, &y, &x_root, &y_root);
-
event = gdk_event_touchpad_pinch_new (seat->pointer_info.focus,
seat->master_pointer,
seat->pointer,
_time,
device_get_modifiers (seat->master_pointer),
phase,
- x, y,
+ seat->pointer_info.surface_x,
+ seat->pointer_info.surface_y,
n_fingers,
dx, dy,
scale, angle_delta * G_PI / 180);
{
GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (tablet->seat);
GdkEvent *event;
- double x, y, x_root, y_root;
- get_coordinates (tablet->master, &x, &y, &x_root, &y_root);
event = gdk_event_button_new (evtype,
tablet->pointer_info.focus,
tablet->master,
tablet->pointer_info.time,
device_get_modifiers (seat->master_pointer),
button,
- x, y,
+ tablet->pointer_info.surface_x,
+ tablet->pointer_info.surface_y,
tablet_copy_axes (tablet));
gdk_wayland_tablet_set_frame_event (tablet, event);
}
GdkWaylandTabletData *tablet = tool->current_tablet;
GdkWaylandSeat *seat = GDK_WAYLAND_SEAT (tool->seat);
GdkEvent *event;
- double x, y, x_root, y_root;
tablet->pointer_info.surface_x = wl_fixed_to_double (sx);
tablet->pointer_info.surface_y = wl_fixed_to_double (sy);
tablet->pointer_info.surface_x,
tablet->pointer_info.surface_y));
- get_coordinates (tablet->master, &x, &y, &x_root, &y_root);
event = gdk_event_motion_new (tablet->pointer_info.focus,
tablet->master,
tablet->current_device,
tool->tool,
tablet->pointer_info.time,
device_get_modifiers (tablet->master),
- x, y,
+ tablet->pointer_info.surface_x,
+ tablet->pointer_info.surface_y,
tablet_copy_axes (tablet));
gdk_wayland_tablet_set_frame_event (tablet, event);